<template>
<div class="pd_tb10">
    <div class="flex_sb mb10">
        <div class="title_1">投标结果记录</div>
        <!-- <el-button plain icon="Plus" type="primary" @click="add">新增</el-button> -->
    </div>
    <el-table v-loading="loading" :data="tableList">
        <el-table-column label="序号" type="index"  min-width="60" align="center"/>
        <el-table-column label="我司参与方式" prop="bidWayStr" min-width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column label="我司份额(%)" prop="bidShare" min-width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column label="我司中标保费(万元)" prop="bidAmount" min-width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column label="中标日期" prop="bidDate" min-width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column label="中标/落标原因分析" prop="bidCause" min-width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column label="操作" align="center" fixed="right" min-width="160" class-name="small-padding fixed-width">
          <template #default="{ row }">
              <el-button link type="primary" @click="fileDataVisible = true">查看附件</el-button>
              <el-button link type="primary" @click="showDetail('detail')">详情</el-button>
          </template>
        </el-table-column>
    </el-table>
    <pagination
        v-show="total > 10"
        :total="total"
        v-model:page="queryParams.pageNo"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
    />

    <!-- 审批、详情 -->
    <el-dialog v-model="detailFormVisible" :title="'投标结果记录' + dialogTypeName" width="60%" append-to-body>
      <DetailForm class="mb10" :dataSources="addFormData" :columns="followColumns">
        <template #fileIds>
          <el-button link type="primary">test.doc</el-button>
        </template>
      </DetailForm>
    </el-dialog>

    <!-- 查看附件 -->
    <el-dialog v-model="fileDataVisible" title="查看附件" width="50%" append-to-body>
      <el-form :model="fileData" label-width="auto">
        <el-form-item label="附件" prop="followupDesc">
          <el-button link type="primary">test.doc</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
</div>
</template>
        
<script setup>
import { computed } from 'vue';

const fileDataVisible = ref(false)

const loading = ref(false);
const tableList = ref([]);
const total = ref(0);
const queryParams = reactive({
  certNo: "",
  pageNo: 1,
  pageSize: 10,
});
const getList = () => {
  loading.value = true;
  setTimeout(() => {
    tableList.value = [
      {
        bidWayStr: "线下",
        bidShare: "80",
        bidAmount: "100",
        bidDate: "2024-09-18",
        bidCause: "高效完成商机询价成本核算",
      }
    ];
    total.value = Number(tableList.value.length);
    loading.value = false;
  }, 300);
};
getList();

// 跟进详情-start
const dialogType = ref('')
const dialogTypeName = computed(() => {
    return dialogType.value === 'detail' ? '详情' : '审批'
})
const detailFormVisible = ref(false)
const showDetail = (type) => {
  dialogType.value = type
  detailFormVisible.value = true
}
const followColumns = ref([
  {label: '我司参与方式', column: 'bidWayStr', span: 8},
  {label: '我司份额(%)', column: 'bidShare', span: 8},
  {label: '我司中标保费(万元)', column: 'bidAmount', span: 8},
  {label: '中标日期', column: 'bidDate', span: 8},
  {label: '中标/落标原因分析', column: 'bidCause', span: 16},
  {label: '附件', slot: 'fileIds', span: 24},
])
const addFormData = ref({
  bidWayStr: "线下",
  bidShare: "80",
  bidAmount: "100",
  bidDate: "2024-09-18",
  bidCause: "高效完成商机询价成本核算",
})
// 跟进详情-end
</script>
      
<style lang="scss" scoped>
.pd_tb10 {
  padding: 10px 0;
}
</style>